set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTIS ON)

set(Boost_ADDITIONAL_VERSIONS ${Boost_ADDITIONAL_VERSIONS} "1.47" "1.47.0" "1.48" "1.48.0" "1.49")
set(Boost_USE_STATIC_LIBS       OFF)
if(WIN32)
set(BOOST_ROOT                  "C:\\Boost")
set(Boost_USE_STATIC_LIBS       ON)
endif(WIN32)
set(Boost_USE_MULTITHREADED     ON)
set(Boost_USE_STATIC_RUNTIME    OFF)
set(Boost_NO_SYSTEM_PATHS       OFF)
set(Boost_DEBUG OFF)

find_package(Boost)# REQUIRED COMPONENTS system thread filesystem regex)
if(Boost_FOUND)
    #message("boost include dir: ${Boost_INCLUDE_DIRS}")
    #message("boost library dir: ${Boost_LIBRARY_DIRS}")
    #message("boost libraries: ${Boost_LIBRARIES}")
    include_directories(${Boost_INCLUDE_DIRS})
    link_directories(${Boost_LIBRARY_DIRS})
else(Boost_FOUND)
    message("boot library not found, force exit!")
endif(Boost_FOUND)

if(WIN32)
    add_definitions(-D__WIN32__)
    #    foreach (flag_var
    #            CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
    #            CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
    #    string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
    #    endforeach()    

elseif(UNIX)
    add_definitions(-DLINUX)
endif(WIN32)
 
#macro(add_include)
#    include_directories(../include)
#    foreach(dep ${ARGV})
#        include_directories(../../${dep}/include)
#    endforeach(dep)
#endmacro(add_include DEP_LIBS)
#
#macro(build_target)
#    set(TARGET_NAME ${ARGV0})
#    if(NOT ${ARGC} MATCHES 1)
#        set(PARAMETER ${ARGV})
#        list(REMOVE_AT ${PARAMETER} 0)
#        set(DEPEND_LIBRARIES ${PARAMETER})
#        foreach(D ${PARAMETER})
#            add_subdirectory(${D}/src)
#        endforeach(D ${PARAMETER})
#    endif(NOT ${ARGC} MATCHES 1)
#endmacro(build_target)


